package com.healthtop.dao;

import com.healthtop.mapper.XsArticleCategoryMapper;
import com.healthtop.model.XsArticleCategory;
import com.healthtop.model.XsArticleCategoryExample;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;

import java.util.List;

@Repository
public class XsArticleCategoryDao {

    @Autowired
    private XsArticleCategoryMapper xsArticleCategoryMapper;

    public XsArticleCategory selectById(Long id) {
       return xsArticleCategoryMapper.selectByPrimaryKey(id);
    }

    public void insert(XsArticleCategory xsArticleCategory) {
        xsArticleCategoryMapper.insertSelective(xsArticleCategory);
    }

    public void update(XsArticleCategory xsArticleCategory) {
        xsArticleCategoryMapper.updateByPrimaryKeySelective(xsArticleCategory);
    }

    public List<XsArticleCategory> selectByGameId(Long gameId) {
        XsArticleCategoryExample example = new XsArticleCategoryExample();
        example.createCriteria().andGameIdEqualTo(gameId).andDelFalgEqualTo("0");
        return xsArticleCategoryMapper.selectByExample(example);
    }
}
